package com.itheima.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.mapper.EmpExprMapper;
import com.itheima.pojo.EmpExpr;
import com.itheima.service.EmpExprService;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.List;

@Service
public class EmpExprServiceImpl extends ServiceImpl<EmpExprMapper, EmpExpr> implements EmpExprService{
    @Override
    public void deleteByEmpIds(List<Integer> ids) {
        LambdaQueryWrapper<EmpExpr> empExprLambdaQueryWrapper = new LambdaQueryWrapper<>();
        empExprLambdaQueryWrapper.in(!CollectionUtils.isEmpty(ids),EmpExpr::getEmpId, ids);

        LambdaQueryChainWrapper<EmpExpr> in = lambdaQuery().in(EmpExpr::getEmpId, ids);
        remove(empExprLambdaQueryWrapper);
    }

    @Override
    public List<EmpExpr> getByEmpId(Integer id) {
        LambdaQueryWrapper<EmpExpr> wrapper = new LambdaQueryWrapper<EmpExpr>().eq(EmpExpr::getEmpId, id);
//        emp.setExprList(exprService.list(wrapper));
//        lambdaQuery().eq(EmpExpr::getEmpId, id).list();
        return list(wrapper);
    }
}
